package com.skyz.base.adapter;


import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.skyz.base.R;
import com.skyz.base.manager.EnvironmentManager;

public class EnvironmentAdapter extends BaseRecyclerViewAdapter<EnvironmentManager.Environment, EnvironmentAdapter.EnvironmentViewHolder> {


    @Override
    protected int getInitLoadLayoutId() {
        return 0;
    }

    @Override
    protected int getNoDataLayoutId() {
        return 0;
    }

    @Override
    protected int getLoadErrorLayoutId() {
        return 0;
    }

    @Override
    protected EnvironmentViewHolder onBaseCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_environment, parent, false);
        return new EnvironmentViewHolder(view);
    }

    @Override
    protected void onBaseBindViewHolder(EnvironmentViewHolder viewHolder, EnvironmentManager.Environment environment) {
        String content = environment.getName() + "(" + environment.getBaseUrl() + ")";
        viewHolder.mTvEnvironmentName.setText(content);
    }

    public static class EnvironmentViewHolder extends BaseRecyclerViewAdapter.BaseViewHolder {

        private final TextView mTvEnvironmentName;

        public EnvironmentViewHolder(@NonNull View itemView) {
            super(itemView);
            mTvEnvironmentName = itemView.findViewById(R.id.tv_environment_name);
        }
    }
}
